import { createRouter, createWebHistory } from "vue-router";

const Layout = () => import(/* webpackChunkName: "home" */ "@/views/HomeView");

const routes = [
  {
    path: "/",
    name: "home",
    component: Layout,
    redirect: "/products/manage",
    children: [
      {
        path: "/products/manage",
        name: "manage",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage"),
        meta: {
          title: "商品管理"
        }
      },
      {
        path: "/products/manage/add",
        name: "manage-add",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage/addOrEidtProducts"),
        meta: {
          title: "发布新品"
        }
      },
      {
        path: "/products/manage/preview",
        name: "manage-preview",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage/preview"),
        meta: {
          title: "商品预览"
        }
      },
      {
        path: "/products/manage/edit",
        name: "manage-edit",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage/addOrEidtProducts"),
        meta: {
          title: "编辑商品"
        }
      },
      {
        path: "/products/manage/copy",
        name: "manage-copy",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage/addOrEidtProducts"),
        meta: {
          title: "复制商品"
        }
      },
      {
        path: "/products/manage/re-applay",
        name: "manage-re-applay",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/manage/addOrEidtProducts"),
        meta: {
          title: "重新申请"
        }
      },
      {
        path: "/products/selection",
        name: "selection",
        component: () => import(/* webpackChunkName: "home" */ "@/views/products/selection"),
        meta: {
          title: "选品中心"
        }
      },
      {
        path: "/stencil/warranty",
        name: "stencil-warranty",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/index")
      },
      {
        path: "/stencil/warranty/add",
        name: "stencil-warranty-add",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/update"),
        meta: {
          title: "新增商品质保模板"
        }
      },
      {
        path: "/stencil/warranty/edit",
        name: "stencil-warranty-edit",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/update"),
        meta: {
          title: "编辑商品质保模板"
        }
      },
      {
        path: "/stencil/warranty/view",
        name: "stencil-warranty-view",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/view"),
        meta: {
          title: "质保模板详情"
        }
      },
      {
        path: "/stencil/warranty/goodsList",
        name: "stencil-warranty-goodsList",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/goodsList"),
        meta: {
          title: "关联商品列表"
        }
      },
      {
        path: "/stencil/warranty/related",
        name: "stencil-warranty-related",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/warranty/related"),
        meta: {
          title: "添加关联商品"
        }
      },
      // =============================订单管理==============
      {
        path: "/order/procure",
        name: "order-procure",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure"),
        meta: {
          title: "订单采购"
        }
      },
      {
        path: "/order/procure/send",
        name: "order-procure-send",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure/send"),
        meta: {
          title: "订单发货"
        }
      },
      {
        path: "/order/procure/delivery",
        name: "order-procure-delivery",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure/delivery"),
        meta: {
          title: "订单配送发货"
        }
      },
      {
        path: "/order/procure/list",
        name: "order-procure-list",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure/list"),
        meta: {
          title: "清单"
        }
      },
      {
        path: "/order/procure/detail",
        name: "order-procure-detail",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure/detail"),
        meta: {
          title: "订单详情"
        }
      },
      {
        path: "/order/procure/edit-logis",
        name: "order-procure-edit-logis",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/procure/edit-logis"),
        meta: {
          title: "修改物流"
        }
      },
      {
        path: "/order/print",
        name: "order-print",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/print"),
        meta: {
          title: "发货打印管理"
        }
      },
      // ===============================采购单收款结算管理=======
      {
        path: "/order/payment",
        name: "order-payment",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/payment"),
        meta: {
          title: "采购单收款结算管理"
        }
      },
      {
        path: "/order/payment/detail",
        name: "order-payment-detail",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/payment/detail"),
        meta: {
          title: "订单结算汇总明细"
        }
      },
      // ===============================生产周期设置=======
      {
        path: "/mallConfig/cycle-time",
        name: "mallConfig-cycle-time",
        component: () => import(/* webpackChunkName: "home" */ "@/views/mallConfig/cycle-time"),
        meta: {
          title: "生产周期设置"
        }
      },
      // ===============================定制测量预购单=======
      {
        path: "/order/measure",
        name: "order-measure",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/measure"),
        meta: {
          title: "定制测量预购单"
        }
      },
      {
        path: "/order/measure/detail",
        name: "order-measure-detail",
        component: () => import(/* webpackChunkName: "home" */ "@/views/order/measure/detail"),
        meta: {
          title: "测量预购单详情"
        }
      } ,
      /* 商品定制模板*/
      {
        path: "/shopConfig/customization/list",
        name: "customization-list",
        component: () => import(/* webpackChunkName: "home" */ "@/views/shopConfig/customization/templates/list"),
        meta: {
          title: "商品定制模板"
        }
      },
      {
        path: "/shopConfig/customization/add",
        name: "customization-add",
        component: () => import(/* webpackChunkName: "home" */ "@/views/shopConfig/customization/templates/add"),
        meta: {
          title: "商品定制模板"
        }
      },
      {
        path: "/shopConfig/customization/RelatedProducts",
        name: "customization-RelatedProducts",
        component: () => import(/* webpackChunkName: "home" */ "@/views/shopConfig/customization/templates/RelatedProducts"),
        meta: {
          title: "商品定制模板"
        }
      },
      {
        path: "/shopConfig/customization/related",
        name: "customization-related",
        component: () => import(/* webpackChunkName: "home" */ "@/views/shopConfig/customization/templates/related"),
        meta: {
          title: "添加关联商品"
        }
      }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(window.__MICRO_APP_BASE_ROUTE__ || "/"),
  routes
});

export default router;
